﻿using Ripple.TestClient.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ripple.TestClient.Views
{
    /// <summary>
    /// Interaction logic for ActionBarView.xaml
    /// </summary>
    public partial class ActionBarView : UserControl
    {
        private ActionBarViewModel viewModel;

        public ActionBarView()
        {
            InitializeComponent();

            this.DataContextChanged += ActionBarView_DataContextChanged;
        }

        private void ActionBarView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.viewModel = e.NewValue as ActionBarViewModel;

            this.viewModel.NotFound += viewModel_NotFound;
            this.AccountId.SelectAll();
            this.AccountId.Focus();
        }

        private void viewModel_NotFound(object sender, EventArgs e)
        {
            MessageBox.Show("Acccount not found");
        }
    }
}